<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    
	
	<title>_${customer.customerName}_入库状态查询</title>
	<script type="text/javascript">
	
        $(function() {
		    $("#queryForm").validate(); 
			$("#_fromDate").datepicker({ format : 'yyyy-mm-dd' });
			$("#_toDate").datepicker({ format : 'yyyy-mm-dd' });
       });
       
       
       //级联商家仓库
	  function loadWarehouse(customerCode,sel_warehouse_id){
		  $("#"+sel_warehouse_id).html("");
		  $.ajax({
				type : 'post',
				url : '${ctx}/warehouse/ajaxGetWarehouse',
				data : {
					customerCode:customerCode,
					queryType:'customerAndPaiu'
				},
				dataType : 'json',
				success : function(data) {
				    var warehouseList=data.warehouseList;
				    var str="<option value='' selected='selected'></option>";
					$.each(warehouseList, function(i) {
					    var warehouse=warehouseList[i];
					    str+="<option value='"+warehouse.groupCode+"'>"+warehouse.groupName+"</option>";
					});
					$("#"+sel_warehouse_id).html(str);
					$("#"+sel_warehouse_id).trigger("chosen:updated");
					$('#_warehouseCode').val(warehouseCode);
				},
				error : function() {
					alert("网络繁忙，请稍后重试...");
				}
			});
	  }
	  
    </script>
</head>

<body>
	<div style="height: 10px;"></div>
	
	<form class="form-search" id="queryForm" action="${ctx}/cusInstorageMsg/queryCusInstorageBill" method="post">
	<table class="table table-striped table-bordered table-condensed" style="margin-top: 0px;">
		<thead>
			<th style="vertical-align: middle; color: white; " colspan="1" bgcolor="#8EB4CB">条件查询</th>
		</thead>
		
		<tr style="height: 50px;">
		   <td>
			    <label style="margin-left: 10px;">商家名称：</label>
				 <select  name="_customerCode"  id="_customerCode" value="${param._customerCode}"  class="required" style="width: 157px;" onchange="loadWarehouse(this.value,'_warehouseCode');">
					<option value=""></option>
					<c:forEach items="${customerList}" var="customer">
						<option value="${customer.customerCode}"
						<c:if test="${param._customerCode eq customer.customerCode}">selected=selected</c:if>
						>${customer.customerName}</option>
					</c:forEach>
				</select>
				
				<label style="margin-left:10px;">作业仓库：</label> 
				<select  name="_warehouseCode"  id="_warehouseCode" value="${param._warehouseCode}" style="width: 157px;">
					<option value=""></option>
					<c:forEach items="${warehouseList}" var="wm">
						<option value="${wm.groupCode}"
						<c:if test="${param._warehouseCode eq wm.groupCode}">selected=selected</c:if>
						>${wm.groupName}</option>
					</c:forEach>
				</select>
				
				 <label>&nbsp;&nbsp;&nbsp;入库日期&nbsp;&nbsp;&nbsp;从：</label> 
			 	<input type="text" name="_fromDate" id="_fromDate"   class="input-medium " value="${param._fromDate}" style="margin-left: -10px;"> 
			 	<label>至：</label> 
			 	<input type="text" name="_toDate" id="_toDate"  class="input-medium " value="${param._toDate}" style="margin-left: -10px;"> 
			 	
				
			 </td></tr>
			     
			 <tr><td>
			 
			   <label style="margin-left:10px;">入库单号：</label> 
				<input  name="_instorageCode"  id="_instorageCode" value="${param._instorageCode}"  class="input-medium " />
			    
				
				<label style="margin-left:10px;">入库状态：</label> 
				<select  name="_status"  id="_status" value="${param._status}"  style="width: 157px;">
					<option value="" <c:if test="${param._status eq ''}">selected=selected</c:if> ></option>
				    <option value="1" <c:if test="${param._status eq '1'}">selected=selected</c:if> >已登记</option>
				    <option value="2" <c:if test="${param._status eq '2'}">selected=selected</c:if> >已点收</option>
				    <option value="3" <c:if test="${param._status eq '3'}">selected=selected</c:if> >审核通过</option>
				    <option value="4" <c:if test="${param._status eq '4'}">selected=selected</c:if> >审核驳回</option>
				    <option value="5" <c:if test="${param._status eq '5'}">selected=selected</c:if> >任务分配</option>
				    <option value="6" <c:if test="${param._status eq '6'}">selected=selected</c:if> >上架完成</option>
				</select>
			   
			    <button type="submit" class="btn btn-info" style="margin-left: 10px;">搜索</button>
			 
			 </td></tr>    
			     
	</table>
	  </form>
	
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr>
		    <th style="width: 100px;">商家名称</th>
		    <th style="width: 180px;">入库单号</th>
		    <th style="width: 80px;">入库类型</th>
		     <th style="width: 80px;">入库仓库</th>
		    <th style="width: 80px;">出货仓库</th>
		    <th style="width: 80px;">相关单号</th>
			<th style="width: 80px;">箱子数量</th>
			<th style="width: 80px;">SKU数量</th>
			<th style="width: 80px;">商品数量</th>
			<th style="width: 150px;">入库时间</th>
			<th style="width: 110px;">当前状态</th>
			<th style="width: 100px;">登记人</th>
			<th style="width: 150px;">管理</th>
		</tr></thead>
		<tbody>
		
		<c:if test="${empty billList or billList.size() eq 0}">
	       <tr><td colspan="19" height="50" style="vertical-align:middle; text-align: center;color: gray;font-size: 20px;">无数据</td></tr>
	    </c:if>
		
		<c:if test="${not empty billList}">
		<c:forEach items="${billList}" var="bill">
			<tr>
			    <td>${bill.customer.customerName}</td>
			    <td>${bill.instorageCode}</td>
			     <td>
			      <c:if test="${bill.billType eq '1' }">总仓入库</c:if>
			      <c:if test="${bill.billType eq '2' }">调拨入库</c:if>
			    </td>
			    <td>${bill.inwarehouse.groupName}</td>
			    <td>
			      <c:if test="${bill.billType eq '2' }">${bill.outwarehouse.groupName}</c:if>
			    </td>
			    <td>${bill.aboutCode}</td>
			    <td>${bill.boxNum}</td>
			    <td>${bill.skuNum}</td>
			    <td>${bill.goodsNum}</td>
			    <td>${fn:substring(bill.inTime,0,19)}</td>
			    <td>
			        <c:if test="${bill.status eq '0' }">未登记，在途中</c:if>
			       <c:if test="${bill.status eq '1' }">已登记</c:if>
			       <c:if test="${bill.status eq '2' }">已点收</c:if>
			       <c:if test="${bill.status eq '3' }">审核通过</c:if>
			       <c:if test="${bill.status eq '4' }">审核不通过</c:if>
			       <c:if test="${bill.status eq '5' }">任务执行中</c:if>
			       <c:if test="${bill.status eq '6' }">上架完成</c:if>
			    </td>
			    <td>${bill.creater.realname}</td>
				<td>
					<a href="${ctx}/cusInstorageMsg/detail/${bill.id}" data-toggle="modal" class="btn btn-info" onclick="update('${bill.id}');">详情</a>
				</td>
			</tr>
		</c:forEach>
		</c:if>
		
		</tbody>
	</table>
	
</body>
</html>
